/****************************************************************************
 * @file    FloraIniManager.h
 * @brief   A configuration manager for INI files.
 * @details This class provides functionality to read and write values to
 *          an INI file using QSettings. It supports multiple data types
 *          including bool, int, QString, and QStringList.
 *
 * @author  繁花遁
 * @date    2024-08-30
 ****************************************************************************/

#ifndef FLORAINIMANAGER_H
#define FLORAINIMANAGER_H

#include <QString>
#include <QSettings>
#include <QStringList>
#include <QLineEdit>
class FloraIniManager {
public:
    FloraIniManager(const QString &filePath);

    bool getBool(const QString &section, const QString &key);
    int getInt(const QString &section, const QString &key);
    QString getString(const QString &section, const QString &key);
    QStringList getStringList(const QString &section, const QString &key);

    void setValue(const QString &section, const QString &key, bool value);
    void setValue(const QString &section, const QString &key, int value);
    void setValue(const QString &section, const QString &key, const QString &value);
    void setValue(const QString &section, const QString &key, const QStringList &value);
    void saveLintEdit( QString section,QLineEdit *le);
    QString getLe( QString section,QLineEdit *le);
    void saveWidget( QString section,QWidget *widget);
    void loadWidget( QString section,QWidget *widget);
private:
    QSettings settings;
};

#endif // FLORAINIMANAGER_H
